﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HMIS.FrameWork;
using HMIS.FrameWork.DomainBase;
using Iesi.Collections.Generic;


namespace HMIS.Infrastructure.Core
{
    /// <summary>
    /// 字典类别
    /// </summary>
    public class DicCategory : TreeNode
    {
        public override string TreeCode
        {
            get
            {
                return base.TreeCode;
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    throw new NotNullException();
                base.TreeCode = value;
            }
        }

        public override string Name
        {
            get
            {
                return base.Name;
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    throw new NotNullException();
                base.Name = value;
            }
        }
        /// <summary>
        /// 包含的字典
        /// </summary>
        public virtual Iesi.Collections.Generic.ISet<Dictionary> Dics { get; set; }

        /// <summary>
        /// 节点深度
        /// </summary>
        public override int Level
        {
            get
            {
                return base.Level;
            }
            set
            {
                if (base.Level > 2)
                    throw new ValidationException("约定此业务对象的节点深度不超过2");
                base.Level = value;
            }
        }
    }

    /// <summary>
    /// 字典
    /// </summary>
    public class Dictionary : InputItem
    {
        /// <summary>
        /// 排序
        /// </summary>
        public virtual int Index { get; set; }

        /// <summary>
        /// 字典类别
        /// </summary>
        public virtual DicCategory Category { get; set; }

    }
}
